package tgc.edu.ljc.controller;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import tgc.edu.ljc.service.StudentService;

@Controller
public class HelloController {
	@Autowired
	private StudentService service;
	
	@RequestMapping("/hello")
	public String hello(ModelMap map) {
		map.put("name", service.findName());
		return "hello";
	}
	@RequestMapping(value= {"/index","/"})
	public String index() {
		return "index";
	}
	
	//@RequestMapping(value="/aaa",produces="text/html;charset=utf-8")
	@RequestMapping(value="/aaa")
	@ResponseBody
	public Object aaa() {
		HashMap<String, Object> m=new HashMap<>();
		m.put("msg", "这是一个ajax调用");
		return m;
	}
	
	@RequestMapping(value="/bbb")
	@ResponseBody
	public Object bbb() {
		return "这是一个ajax调用";
	}
}
